package org.skyer.third.gateway.api.enums.ali;

import java.util.Arrays;
import java.util.List;

public enum AliBaBaOrderStatusEnum {


    WAITBUYERPAY("waitbuyerpay", "等待买家付款"),
    WAITSELLERSEND("waitsellersend", "等待卖家发货"),
    WAITLOGISTICSTAKEIN("waitlogisticstakein", "等待物流公司揽件"),
    WAITBUYERRECEIVE("waitbuyerreceive", "等待买家收货"),
    WAITBUYERSIN("waitbuyersign", "等待买家签收"),
    SIENINSUCCESS("signinsuccess", "买家已签收"),
    CONFIRM_GOODS("confirm_goods", "已收货"),
    SUCCESS("success", "交易成功"),
    CANCEL("cancel", "交易取消"),
    TERMAINATED("terminated", "交易终止"),;




    private String code;
    private String desc;

    AliBaBaOrderStatusEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    AliBaBaOrderStatusEnum() {
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }


    /**
     * 发货中
     * @param code
     * @return
     */
    public static boolean checkIsShipping(String code) {
        List<String> list = Arrays.asList(WAITLOGISTICSTAKEIN.getCode(), WAITBUYERRECEIVE.getCode(), WAITBUYERSIN.getCode()
                , SIENINSUCCESS.getCode(), CONFIRM_GOODS.getCode(), SUCCESS.getCode());
        if (list.contains(code)) {
            return true;
        }
        return false;
    }

    /**
     * 是否需要退货退款
     * @param code
     * @return
     */
    public static boolean checkGoodsRefund(String code) {
        List<String> list = Arrays.asList( SIENINSUCCESS.getCode(), CONFIRM_GOODS.getCode(), SUCCESS.getCode());
        if (list.contains(code)) {
            return true;
        }
        return false;
    }

    /**
     * 是否仅退款
     * @param code
     * @return
     */
    public static boolean checkOnlyRefund(String code) {
        List<String> list = Arrays.asList( WAITSELLERSEND.getCode(), WAITLOGISTICSTAKEIN.getCode(), WAITBUYERRECEIVE.getCode(),WAITBUYERSIN.getCode());
        if (list.contains(code)) {
            return true;
        }
        return false;
    }




}
